package com.ruoyi.web.tdm.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.tdm.domain.TdmHplcQiTe;
import com.ruoyi.web.tdm.service.ITdmHplcQiTeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * HPLC-其他Controller
 * 
 * @author ly
 * @date 2022-03-11
 */
@RestController
@RequestMapping("/tdm/TdmHplcQiTe")
public class TdmHplcQiTeController extends BaseController
{
    @Autowired
    private ITdmHplcQiTeService tdmHplcQiTeService;

    /**
     * 查询HPLC-其他列表
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:list')")
    @GetMapping("/list")
    public TableDataInfo list(TdmHplcQiTe tdmHplcQiTe)
    {
        startPage();
        List<TdmHplcQiTe> list = tdmHplcQiTeService.selectTdmHplcQiTeList(tdmHplcQiTe);
        return getDataTable(list);
    }

    /**
     * 导出HPLC-其他列表
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:export')")
    @Log(title = "HPLC-其他", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TdmHplcQiTe tdmHplcQiTe)
    {
        List<TdmHplcQiTe> list = tdmHplcQiTeService.selectTdmHplcQiTeList(tdmHplcQiTe);
        ExcelUtil<TdmHplcQiTe> util = new ExcelUtil<TdmHplcQiTe>(TdmHplcQiTe.class);
        util.exportExcel(response, list, "HPLC-其他数据");
    }

    /**
     * 获取HPLC-其他详细信息
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tdmHplcQiTeService.selectTdmHplcQiTeById(id));
    }

    /**
     * 新增HPLC-其他
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:add')")
    @Log(title = "HPLC-其他", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TdmHplcQiTe tdmHplcQiTe)
    {
        return toAjax(tdmHplcQiTeService.insertTdmHplcQiTe(tdmHplcQiTe));
    }

    /**
     * 修改HPLC-其他
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:edit')")
    @Log(title = "HPLC-其他", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TdmHplcQiTe tdmHplcQiTe)
    {
        return toAjax(tdmHplcQiTeService.updateTdmHplcQiTe(tdmHplcQiTe));
    }

    /**
     * 删除HPLC-其他
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmHplcQiTe:remove')")
    @Log(title = "HPLC-其他", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tdmHplcQiTeService.deleteTdmHplcQiTeByIds(ids));
    }
}
